#绘制图形
#pygame的官网地址：https://www.osgeo.cn/pygame/

import pygame,random,sys,math

pygame.init()
screen=pygame.display.set_mode([640,480])
screen.fill([255,255,255])


for i in range(0,10):
    red=random.randint(0,255)
    green=random.randint(0,255)
    blue=random.randint(0,255)

    x=random.randint(0,640)
    y=random.randint(0,480)
    offsetX=random.randint(0,640)
    offsety=random.randint(0,480)

    size_x=random.randint(5,100)
    size_y=random.randint(6,90)

    startAngle=math.radians(random.randint(15,350))
    endAngle=math.radians(random.randint(6,316))
    
    # pygame.draw.line(screen,[red,green,blue],[x,y],[offsetX,offsety],2)  #绘制直线

    # pygame.draw.arc(screen,[red,green,blue],[x,y,size_x,size_y],startAngle,endAngle,1)  #绘制弧

    # pygame.draw.ellipse(screen,[red,green,blue],[x,y,size_x,size_y],2)  #绘制椭圆

    pygame.draw.polygon(screen,[red,green,blue],[[x,y],[offsetX,offsety],[size_x,size_y]]) #绘制多边形

pygame.display.flip()

while True:
    for event in pygame.event.get():
        if event.type==pygame.QUIT:
            sys.exit()